package com.taotao.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.taotao.manage.pojo.ItemDesc;
import com.taotao.manage.pojo.ItemVO;
import com.taotao.web.service.ItemDescService;
import com.taotao.web.service.ItemService;

@Controller
@RequestMapping("item")
public class ItemController {
	
	@Autowired
	private ItemService itemService;
	
	@Autowired
	private ItemDescService itemDescService;
	
	@RequestMapping(value = "{itemId}",method = RequestMethod.GET)
	public String showItem(@PathVariable("itemId")Long id,Model model){
		ItemVO itemVo = itemService.showItem(id);
		ItemDesc itemDesc = itemDescService.showItemDesc(id);
		model.addAttribute("item", itemVo);
		model.addAttribute("itemDesc", itemDesc);
		return "item";
		
	}
}
